package com.ct.boot.launch;

import lombok.Data;

/**
 * @Auther: 1
 * @Date: 2020/6/12 11:26
 * @Description:
 */
@Data
public class AjaxResponse {
    private boolean isOk;
    private  int code;
    private String message;
    private Object data;

    public AjaxResponse() {
    }
    public static AjaxResponse success(Object obj,String message){
        AjaxResponse ajaxResponse = new AjaxResponse();
        ajaxResponse.setOk(true);
        ajaxResponse.setCode(200);
        ajaxResponse.setMessage(message);
        ajaxResponse.setData(obj);
        return ajaxResponse;
    }
    public static AjaxResponse success(Object obj){
        AjaxResponse ajaxResponse = new AjaxResponse();
        ajaxResponse.setOk(true);
        ajaxResponse.setCode(200);
        ajaxResponse.setMessage("响应成功");
        ajaxResponse.setData(obj);
        return ajaxResponse;
    }
    public static AjaxResponse success(String message){
        AjaxResponse ajaxResponse = new AjaxResponse();
        ajaxResponse.setMessage(message);
        return ajaxResponse;
    }
    public static AjaxResponse success(){
        AjaxResponse ajaxResponse = new AjaxResponse();
        ajaxResponse.setOk(true);
        ajaxResponse.setCode(200);
        ajaxResponse.setMessage("删除成功");
        return ajaxResponse;
    }
}
